package cn.crce.cloud9.basic;

import javax.swing.*;

/**
 * @author OnCloud9
 * @description
 * @project NRCE-TEST
 * @date 2022年09月10日 上午 12:12
 */
public class Case35 {
    public static void main( String args[] ){
        //*********Found**********
        StringBuffer buf = new StringBuffer( "Hello, how are you?" );
        String output = "buf = " + buf.toString() +
                "\nlength = " + buf.length() +
                "\ncapacity = " + buf.capacity();
        buf.ensureCapacity( 75 );
        output += "\n\nNew capacity = " + buf.capacity();
        buf.setLength( 10 );
        //*********Found**********
        output += "\n\nNew length = " + buf.length() +
                "\nbuf = " + buf.toString();
        JOptionPane.showMessageDialog( null, output,
                "字符串缓存长度和容量的实例",
                //*********Found**********
                JOptionPane.INFORMATION_MESSAGE );
        //*********Found**********
        System.exit( 0 );
    }
}
